﻿using UnityEngine;
using System.Collections;

namespace Room { 
    public class RCAIGuardAttack : RCAIGuardBase
    {
        GameObject effect;
        protected override void OnEnter()
        {
            controller.owner.PlayAnim(AniName.STAND_FIGHT);
            if (effect == null)
            {
                effect = controller.Spawn(RoomUnionFight.DEFENSE);
                effect.transform.localPosition = new Vector3(0, 2, 0);
            }
            else
            {
                effect.SetActive(true);
            }
        }

        protected override void OnTick()
        {
            controller.owner.move.StopMove();
        }

        protected override void OnLeave()
        {
            if(effect!=null)
            {
                controller.Unspawn(effect);
                effect = null;
            }
        }
    }
}